//
//  ViewController.m
//  advertiseDemo
//
//  Created by zhouhuanqiang on 16/5/22.
//  Copyright © 2016年 zhouhuanqiang. All rights reserved.
//

#import "ViewController.h"
#import "AdvertiseViewController.h"
#import "UIWebViewDemoController.h"
#import "WKWebDemoController.h"

@interface ViewController ()


@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.title = @"首页";
    
    self.view.backgroundColor = [UIColor orangeColor];
    
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(pushToAd) name:@"pushtoad" object:nil];
    
    
    UIButton *goWKWebBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    goWKWebBtn.frame = CGRectMake(0, 84, 150, 44);
    [goWKWebBtn setTitle:@"点击加载WKWeb" forState:UIControlStateNormal];
    [goWKWebBtn setBackgroundColor:[UIColor magentaColor]];
    [goWKWebBtn addTarget:self action:@selector(gotoWKWebView:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:goWKWebBtn];
    
    UIButton *goUIWebBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    goUIWebBtn.frame = CGRectMake(0, 148, 150, 44);
    [goUIWebBtn setTitle:@"点击加载WKWeb" forState:UIControlStateNormal];
    [goUIWebBtn setBackgroundColor:[UIColor magentaColor]];
    [goUIWebBtn addTarget:self action:@selector(gotoUIWebView:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:goUIWebBtn];
    
}

- (void)gotoWKWebView:(UIButton *)sender {
    [self.navigationController pushViewController:[WKWebDemoController new] animated:YES];
}

- (void)gotoUIWebView:(UIButton *)sender {
    [self.navigationController pushViewController:[UIWebViewDemoController new] animated:YES];
}

- (void)pushToAd {
    
    AdvertiseViewController *adVc = [[AdvertiseViewController alloc] init];
    [self.navigationController pushViewController:adVc animated:YES];
    
}


@end
